package com.itheima.dubbo.service;

import com.itheima.dubbo.UserInterface;
import org.apache.dubbo.config.annotation.DubboService;
import org.apache.dubbo.config.annotation.Method;
import org.apache.dubbo.rpc.RpcContext;

//@DubboService(timeout = 3000)//dubbo 注册到注册中心 //超时时间默认是1s
//@DubboService(methods = {
//        @Method(name = "hello",timeout = 9000) //优先级最高
//})
@DubboService(retries = 0)
public class UserServiceImpl implements UserInterface {

    @Override
    public String hello(String username) {

//        System.out.println("Usernm   。。。。");
        String jwt = RpcContext.getContext().getAttachment("jwt");
        System.out.println(jwt);

        try {
            Thread.sleep(2000L);
        } catch (InterruptedException e) {
                e.printStackTrace();
        }
        return "hello Dubbo username: " +username;
    }
}
